﻿using System;

namespace NodeBasedSkillEditor
{
    public class Value_Enum : AValue
    {
        public override EValueType ValueType { get { return EValueType.Enum; } }

        public Enum Value;

        public Value_Enum(Enum v)
        {
            Value = v;
        }

        public Value_Enum(EnumPort portData)
        {
            Value = portData.Value;
        }

        public override AValue Clone()
        {
            return new Value_Enum(Value);
        }

        public override (bool, Enum) ToEnum()
        {
            return (true, Value);
        }

        public override bool SetEnum(Enum v)
        {
            Value = v;
            return true;
        }

        public override bool EqualsValue(AValue x)
        {
            if (x.ValueType == EValueType.Enum)
            {
                var y = x as Value_Enum;
                return Value.Equals(y.Value);
            }
            return false;
        }

        public override string ToString()
        {
            return Value.ToString();
        }

    }
}
